package com.yuandian.ops.workbench.controller;

import com.yuandian.bpm.common.core.util.R;
import com.yuandian.ops.workbench.enums.DataTypeEnum;
import com.yuandian.ops.workbench.vo.ObservationObjectVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 说明：查询告警对象
 * @Author LinShiHE
 * @Date 2023/05/29 9:38
 */
@RestController
@RequestMapping("/search/option")
public class ObservationObjectController {


    /**
     * 查询告警对象： 数据类型：1-业务，2-区域，3-步骤，4-接口，5-高频，6-經常，7-低频，8-零散
     * @return 通用返回对象
     */
    @GetMapping("/queryObservationObject")
    public R<Object> queryObservationObject() {
		ObservationObjectVo vo1 = new ObservationObjectVo();
        vo1.setCode(DataTypeEnum.HIGH.getDataType().toString());
        vo1.setLabel(DataTypeEnum.HIGH.getDesc());

		ObservationObjectVo vo2 = new ObservationObjectVo();
        vo2.setCode(DataTypeEnum.OFTEN.getDataType().toString());
        vo2.setLabel(DataTypeEnum.OFTEN.getDesc());

		ObservationObjectVo vo3 = new ObservationObjectVo();
        vo3.setCode(DataTypeEnum.LOW.getDataType().toString());
        vo3.setLabel(DataTypeEnum.LOW.getDesc());

		ObservationObjectVo vo4 = new ObservationObjectVo();
        vo4.setCode(DataTypeEnum.IDLE.getDataType().toString());
        vo4.setLabel(DataTypeEnum.IDLE.getDesc());

		ObservationObjectVo vo5 = new ObservationObjectVo();
        vo5.setCode(DataTypeEnum.commonSteps.getDataType().toString());
        vo5.setLabel(DataTypeEnum.commonSteps.getDesc());

		ObservationObjectVo vo6 = new ObservationObjectVo();
        vo6.setCode(DataTypeEnum.commonInterface.getDataType().toString());
        vo6.setLabel(DataTypeEnum.commonInterface.getDesc());

        List<ObservationObjectVo> list = new ArrayList<>(Arrays.asList(vo1, vo2, vo3, vo4, vo5, vo6));

        return R.ok(list);
    }

/*
    *//**
     * 查询告警对象： 数 * 告警指标编码   BS_FAIL_RATE_10:失败率   BS_FAIL_RATE_20：响应时长  BS_FAIL_RATE_30：健康度
     * @return 通用返回对象
     *//*
    @GetMapping("/queryObservationClass")
    public Result queryObservationClass() {
        SearchOptionVo vo1 = new SearchOptionVo();
        vo1.setCode("BS_FAIL_RATE_10");
        vo1.setLabel("失败业务");

        SearchOptionVo vo2 = new SearchOptionVo();
        vo2.setCode("BS_FAIL_RATE_20");
        vo2.setLabel("响应慢业务");

        List<SearchOptionVo> list = new ArrayList<>(Arrays.asList(vo2, vo1));

        return Result.setSuccess(list);
    }*/
}
